<%@page import="java.util.Map"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.HashMap"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Add Delete User page</title>
<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css" />
<link rel="stylesheet" href="css/jquery-ui-1.10.3.css" />
<link rel="stylesheet" href="css/AddDeleteUser.css" />
<style type="text/css">
		.errors {
			background-color: #FFCCCC;
			border: 1px solid #CC0000;
			width: 400px;
			margin-bottom: 8px;
		}
		
		.errors li {
			list-style: none;
		}

</style>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script src="js/jquery-ui-1.10.3.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.3.2.min.js"></script>
<script type="text/javascript" src="js/AddDeleteUser.js"></script>

<script>
	$(document).ready(function(){
	 	 $.mobile.ajaxEnabled = false;
	  	 	$(".usernamesearchField").on("input", function(e) {
			var sugList=$('.avaialusers');
	    	var str="";
	        var text = $(this).val();
	        if(text.length < 1) {
	            sugList.html("");
	            sugList.listview("refresh");
	        } else {
	                $.get("http://server:8080/parvati/Getnameservlet",{methodetocall:'getcustname',name:text},function(res,code){
						for(var i = 0;i<res.split('#').length-1;i++)
							str += "<li><a href=javascript:addtosearchinputcname('"+res.split('#')[i]+"')>"+res.split('#')[i]+"</a></li>"; 
						 	
						 sugList.html(str);
			             sugList.listview("refresh");
		            });
	               
	        }
					
			});
	});

	function addtosearchinputcname(text){
		$('.usernamesearchField').val(text);
		$(".avaialusers").html("");
	}

	function openAnalysis(barcode){
		$('#barcode').val(barcode);
		$('#viewanalysis').submit();		
	}
</script>
</head>

<body>
	<div data-role="page">
		<div data-position="fixed" data-role="header" align="center"
			data-theme="b">
		<a href="menudisplay" data-role="buttun" data-icon="home">Menu</a>	
			<div>&nbsp;</div>
			<div>
				<h1>PARVATI SOLVENTS EXTRACTION PVT LTD</h1>
			</div>
			<div>
				<h3>GUT NO.76, KHADGAON,TALUKA:
					BADNAPUR,DISTRICT:JALNA-431203,MAHARASHTRA,INDIA</h3>
			</div>
			
		</div>
		<br>
		<div data-role="content">
			<ul data-role="listview">
			<%
			HashMap datamap = new HashMap();
			datamap = (HashMap) session.getAttribute("dataanlysismap");
			Iterator iterator = datamap.entrySet().iterator();
			while(iterator.hasNext()){
				Map.Entry barcode = (Map.Entry)iterator.next();
				if(barcode.getValue().toString().equalsIgnoreCase("Y"))
					out.println("<li><img src='Roshan/labsubmit.png'/><a href='javascript:openAnalysis(\""+barcode.getKey()+"\")'>"+barcode.getKey()+"</a></li>");
				else
					out.println("<li><img src='Roshan/wmcsubmit.png'><a href='#'>"+barcode.getKey()+"</a></li>");	
			}
			%>
			</ul>>
		</div>
	</div>
	
	<form id="viewanalysis" action="gotoanalysis" method="post">
		<input type="hidden" id="barcode" name="barcode"/> 
	</form>
</body>
</html>